//package org.sraosha.listener;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.ApplicationListener;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.event.ContextRefreshedEvent;
//import org.springframework.data.mongodb.core.MongoTemplate;
//import org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper;
//import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
//import org.springframework.data.mongodb.core.convert.MongoConverter;
//
//@Configuration
//public class MongodbListener implements ApplicationListener<ContextRefreshedEvent> {
//
//    @Autowired
//    MongoTemplate mongoTemplate;
//
//    private static final String TYPEKEY = "_class";
//
//    @Override
//    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
//        MongoConverter converter = mongoTemplate.getConverter();
//        if (converter.getTypeMapper().isTypeKey(TYPEKEY)) {
//            ((MappingMongoConverter) converter).setTypeMapper(new DefaultMongoTypeMapper(null));
//        }
//    }
//}
